package com.ruoyi.common.config;

import cn.jpush.api.JPushClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @Author: ruohao
 * @Date: 2023/11/16
 **/
@Configuration
@ConfigurationProperties(prefix = "push")
public class JiGuangConfig {
    private String key;

    private String secret;

    public void setKey(String key) {
        this.key = key;
    }

    public String getKey() {
        return this.key;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public String getSecret() {
        return this.secret;
    }

    private JPushClient jPushClient;

    // 推送客户端
    @PostConstruct
    public void initJPushClient() {
        jPushClient = new JPushClient(secret, key);
    }
    // 获取推送客户端
    public JPushClient getJPushClient() {
        return jPushClient;
    }
}
